<!-- @format -->

<template>
  <div id="app">
    <router-view></router-view>
    <FootNav v-if="show"></FootNav>
  </div>
</template>
<script>
import FootNav from "@components/FootNav/FootNav.vue";
import { get } from "@utils/request";
import { mapActions } from "vuex";

// import { getData } from "./main";
// import { instance } from "@utils/request";
export default {
  name: "App",
  data() {
    return {
      show: true
    };
  },
  watch: {
    $route() {
      get("http://localhost:3000/shopcart/findShopcart").then(res => {
        this.sumcount(res?.data?.data?.length);
      });
      // console.log(this.$route.meta);
      if (this.$route.name == "login") {
        // console.log(1);
        this.show = false;
      } else {
        this.show = true;
      }
    }
  },
  created() {
    // console.log(1);
    /*  getData("/api/b2c/init/0-0/init").then(res => {
      console.log(res);
    }); */
    /* setTimeout(() => {
      instance.get("/b2c/init/0-0/init").then(res => {
        let token = res.data.data.token;
        console.log(res.data);
        console.log(token);
        console.log(instance);
        instance.get("/b2c/init/0-0/init").then(res => {
          console.log(res);
        });
      });
    }, 3000); */
  },
  methods: {
    ...mapActions(["sumcount"])
  },
  components: {
    FootNav
  }
};
</script>
<style lang="scss">
html,
body,
#app {
  height: 100%;
  font-size: 37.5px;
}
img {
  max-width: 100%;
}
</style>
